import React, { useEffect, useState } from 'react';
import axios from 'axios';
import Heand from '../../component/heand';
import { useNavigate } from "react-router-dom";
import { Input, Button } from 'antd';

function Add_newdoor_pcclass() {
  const [pcclass,setPcclass]=useState('')
  const [pcclassbcid,setPcclassbcid]=useState('')

   
   const handleNameChangepcclass = (event)=>{
    setPcclass(event.target.value)
   }
   const handleNameChangepcclassbcid = (event)=>{
    setPcclassbcid(event.target.value)
   }

  
   
const handleSubmit= async()=>{
    try {
        const response = await axios.post(`https://r5ctn9z9.lc-cn-n1-shared.com/1.1/classes/pcclass`, {
            bcid:pcclassbcid,
            name:pcclass
        }, {
            headers: {
                " X-LC-Id": "r5CTN9z96pCW8mI8fx9YxOmw-gzGzoHsz",
                "X-LC-Key": "8gSsl4Sz0ILMiQeMNMA8xQqg",
                'Content-Type': 'application/json'
            }
        }).then((e) => {
            // 处理返回的数据
            //   setShowInput(false);

            window.location.reload()

          


            // 更新展示的数据
        })


    } catch (error) {
        console.error(error);
    }
}
  
  return (

    <div className='pushinput'>
      <Heand />

      <form className='pushtj' >
        <div>
          <label htmlFor="name">简介一：</label>
          <Input className="xqinp" type="text" id="name" value={pcclass} onChange={handleNameChangepcclass} />
        </div>
       
       
        <div>
          <label htmlFor="name">ID：</label>
          <Input className="xqinp" type="text" id="name" value={pcclassbcid} onChange={handleNameChangepcclassbcid} />
        </div>

        <Button onClick={handleSubmit} >商品</Button>
      </form>
    </div>
  )
}

export default Add_newdoor_pcclass;